import java.awt.Point;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.Mouse;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPath;

class AionAirCrafter$1 extends AionAirCrafter.ObjectAction
{
  public String getDesc()
  {
    return "Entering mysterious ruins.";
  }

  public boolean isValid() {
    return (AionAirCrafter.access$200(this.this$0)) && (AionAirCrafter.access$3000(this.this$0));
  }

  public void process() {
    if (AionAirCrafter.access$3100(this.this$0).contains(1438)) {
      if (!AionAirCrafter.access$3200(this.this$0).isItemSelected()) {
        AionAirCrafter.access$3300(this.this$0).getItem(new int[] { 1438 }).doClick(true);
      } else {
        localObject = AionAirCrafter.access$3400(this.this$0).getSelectedItem();
        if (((RSItem)localObject).getID() != 1438) {
          ((RSItem)localObject).doClick(true);
          return;
        }
      }
      Object localObject = AionAirCrafter.access$3500(this.this$0).getNearest(new int[] { 2478 });
      if (localObject != null) {
        Point localPoint = AionAirCrafter.access$3600(this.this$0, (RSObject)localObject);
        if ((localPoint.x != -1) && (localPoint.y != -1)) {
          AionAirCrafter.access$3700(this.this$0).click(localPoint, true);
          if (AionAirCrafter.access$3800(this.this$0).distanceTo((RSObject)localObject) > 1) {
            AionAirCrafter.access$1400(this.this$0, this.this$0.random(600, 900));
          }
          return;
        }if (((RSObject)localObject).isOnScreen()) {
          ((RSObject)localObject).doClick(true);
          if (AionAirCrafter.access$3900(this.this$0).distanceTo((RSObject)localObject) > 1)
            AionAirCrafter.access$1400(this.this$0, this.this$0.random(600, 900));
        }
        else {
          AionAirCrafter.access$4000(this.this$0).turnToObject((RSObject)localObject);
          if (!((RSObject)localObject).isOnScreen())
            AionAirCrafter.access$4100(this.this$0).getPath(((RSObject)localObject).getLocation()).traverse();
        }
      }
    } else {
      super.process();
    }
    AionAirCrafter.access$1500(this.this$0);
  }
}